package com.zhongyu.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongyu.pojo.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

public interface ShenHemAPPER extends BaseMapper<Order> {
    @Select("SELECT t1.*, t2.pro_Name,t3.username FROM smbms_order t1 JOIN smbms_provider t2 ON t1.provider_id=t2.id  JOIN smbms_user t3 ON t1.creator AND purchaser=t3.id WHERE state=0 AND TYPE=1 ${ew.customSqlSegment} ")
    @ResultMap("providerRm")
    List<Order> findAll(Page page, @Param("ew") Wrapper wrapper);


    @Select("UPDATE smbms_order SET state=#{state} ,CHECK_TIME=#{checkTime},CHECKER=#{checker} where id=#{id} and type=1")
    void update(@Param("state") String state, @Param("checkTime") LocalDateTime checkTime, @Param("id") Integer id,@Param("checker") Integer shenhe);


}
